var document = require("./document")
const app = getApp()
import { $time } from "../../utils/index"

Page({
  /**
   * 页面的初始数据
   */
  data: {
    document
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {},

  copyCode: function({ currentTarget }) {
    let { index } = currentTarget.dataset
    app.copyCode(this.data.document[index].code)
  },

  openSetting: function() {
    $common.setting({ title: "执行失败", content: "请打开设置页授权xxx权限" }, res => {
      $common.toast({
        msg: "设置回调"
      })
    })
  },

  showToast: function() {
    $common
      .toast({
        msg: "打开toast 3秒",
        icon: "loading",
        time: 3000
      })
      .then(() => {
        $common.toast({
          msg: "显示结束了",
          icon: "loading"
        })
      })
  }
})
